@use '@lingshu/theme-lib/scss/util.scss' as *;

// 颜色系统
$wk-org-page-color: useThemeVar('border2');
$wk-org-card-color: useThemeVar('white1');
$wk-org-legend-color: useThemeVar('gray1');
$wk-org-primary-color: useThemeVar('color_primary');
$wk-org-color-white: useThemeVar('white1');
$wk-org-message-box: #3d3d3d;

// 尺寸
$wk-org-active-node-cancel-right: 80px;
$wk-org-active-node-save-right: 2px;
$wk-org-active-node-save-width: 60px;
$wk-org-active-node-save-height: 32px;
$wk-org-search-input-margin: 14px;
$wk-org-tree-node-padding: 12px;
$wk-org-border-radius: 16px;
$wk-org-card-margin: 24px;
$wk-org-title-height: 56px;
$wk-org-subtitle-top: 59px;
$wk-org-subtitle-width: 4px;
$wk-org-subtitle-radius: 3px;
$wk-org-aside-width: 312px;
$wk-org-tree-wrapper-height: 36px;
$wk-org-header-height: 60px;
$wk-org-legend-line-height: 22px;
$wk-org-form-item-left: 20px;
$wk-org-form-item-center: 10px;
$wk-org-biz-table-margin: 8px 0 10px 0;
$wk-org-tree-tag-margin-left: 8px;
$wk-org-tree-tag-padding-bottom: 6px;
$el-message-box-btns-height: 56px;
$el-message-box-content-height: 62px;
$el-message-box-title-height: 46px;
$el-message-box-title-padding: 15px;
$wk-org-message-box-width: 353px;
$wk-org-scroll-container-height: 89px;

// 字体
$wk-org-tree-font-size: 18px;

.wk-org__wrapper {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.wk-org {
  display: flex;
  height: 0;
  flex: 1;
  gap: $wk-org-card-margin;
  :deep(.wk-org__message-box) {
    width: $wk-org-message-box-width;
    padding: 0;
    border-radius: $wk-org-tree-node-padding;
  }
  :deep(.wk-org__message-box .el-message-box__header) {
    padding: 0;
  }
  :deep(.wk-org__message-box .el-message-box__title) {
    height: $el-message-box-title-height;
    padding: $el-message-box-title-padding $wk-org-form-item-left;
    background: useThemeVar('module_bg1');
    font-size: $wk-org-border-radius;
  }
  :deep(.wk-org__message-box .el-message-box__content) {
    height: $el-message-box-content-height;
  }
  :deep(.wk-org__message-box .el-message-box__btns) {
    height: $el-message-box-btns-height;
    padding: 0 $wk-org-form-item-left;
  }
  :deep(.wk-org__message-box .el-message-box__container) {
    height: 100%;
    justify-content: center;
    color: $wk-org-message-box;
  }
  :deep(.wk-org__message-box .el-message-box__message) {
    padding: $wk-org-form-item-left;
  }
}
.right-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 0;
  // background-color: #5483c7;
}
.form-and-table-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 0;
  border-radius: $wk-org-border-radius;
  overflow: auto;
}
.wk-org__title {
  position: relative;
  height: $wk-org-title-height;
  display: flex;
  align-items: center;
  padding-left: $wk-org-border-radius;
  margin-bottom: $wk-org-card-margin;
  border-radius: $wk-org-border-radius;
  background: $wk-org-card-color;
  line-height: $wk-org-title-height;

  font-size: $wk-org-tree-font-size;
  font-weight: 500;
}
.wk-org__subtitle {
  padding: 6px 16px 20px 16px;
  position: sticky;
  top: 60px;
  background: white;
  width: 100%;
  z-index: 2;
  font-size: 14px;
  font-weight: 500;
  &:before {
    position: absolute;
    top: 8px;
    left: 0;
    width: $wk-org-subtitle-width;
    height: 16px;
    border-radius: $wk-org-subtitle-radius;
    background: $wk-org-primary-color;
    content: '';
  }
  &:after {
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    content: '';
    background: $wk-org-color-white;
  }
}
.wk-org__active-node {
  position: relative;
  height: $wk-org-header-height;
  font-size: 16px;
  font-weight: 500;
  color: $wk-org-primary-color;
}
.wk-org__aside {
  // position: absolute;
  position: relative;
  width: $wk-org-aside-width;
  flex-shrink: 0;
  height: 100%;
  padding: $wk-org-border-radius;
  border-radius: $wk-org-border-radius;
  background: $wk-org-card-color;
  &.searching {
    :deep(.wk-org__tree-node) {
      padding: 0 $wk-org-tree-node-padding;
    }
    :deep(.el-tree-node__expand-icon) {
      display: none;
    }
    :deep(.wk-org__node-highlighted) {
      color: $wk-org-primary-color;
      font-weight: bold;
    }
  }
  :deep(.el-input) {
    --el-input-placeholder-color: useThemeVar('gray1');
  }
  :deep(.el-tree),
  :deep(.el-tree__empty-block) {
    position: unset;
  }
  :deep(.el-dropdown-link) {
    visibility: hidden;
  }
  :deep(.el-input) {
    margin-bottom: 16px;
  }
  :deep(.el-input-group__append) {
    background: $wk-org-color-white;
  }
  :deep(.wk-org__tree__wrapper) {
    height: calc(100% - $wk-org-tree-wrapper-height);
    overflow-y: auto;
  }
  .wk-org__tree-label {
  }
  :deep(.el-tree-node__content) {
    position: relative;
    &:hover {
      .el-dropdown-link {
        visibility: visible;
      }
    }
  }
}
.wk-org__header {
  position: sticky;
  top: 0;
  height: $wk-org-header-height;
  padding: $wk-org-border-radius;
  border-radius: $wk-org-border-radius $wk-org-border-radius 0 0;
  background: $wk-org-card-color;
  z-index: 2;
}
.wk-org__main {
  position: relative;
  padding: 0 $wk-org-border-radius 0 $wk-org-border-radius;
  border-radius: 0;
  background: $wk-org-card-color;
  :deep(.el-form) {
    margin-top: 4px;
  }
}
.wk-org__bottom {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 $wk-org-border-radius $wk-org-border-radius $wk-org-border-radius;
  border-radius: 0 0 $wk-org-border-radius $wk-org-border-radius;
  background: $wk-org-card-color;
  :deep(.el-table thead .el-table__cell) {
    font-weight: 500;
  }
  :deep(.el-table__border-left-patch) {
    width: 0;
  }
}
.wk-org__legend {
  display: flex;
  align-items: center;
  padding: 12px 0 22px 0;

  font-size: $wk-org-search-input-margin;
  font-weight: 500;
  line-height: $wk-org-legend-line-height;
  letter-spacing: normal;
  color: $wk-org-legend-color;
}
.wk-org__form-items {
  display: grid;
  grid-template-columns: repeat(3, 33.3%);
}
.wk-org__form-item {
  &.left-item {
    padding-right: $wk-org-form-item-left;
  }
  &.center-item {
    padding: 0 $wk-org-form-item-center;
  }
  &.right-item {
    padding-left: $wk-org-form-item-left;
  }
  &.plus-item {
    grid-column: span 2;
  }
  &.postal_code {
    grid-column: 1;
  }
}
.wk-org__tree-node {
  &.unstable-item {
    font-weight: bold;
    color: $wk-org-primary-color;
  }
}
.wk-org__active-node-edit,
.wk-org__active-node-save {
  position: absolute;
  right: $wk-org-active-node-save-right;
  width: $wk-org-active-node-save-width;
  height: $wk-org-active-node-save-height;
  color: $wk-org-color-white;
  background: $wk-org-primary-color;
  &:active,
  &:hover,
  &:focus {
    color: $wk-org-color-white;
    background: $wk-org-primary-color;
  }
}
.wk-org__active-node-cancel {
  position: absolute;
  right: $wk-org-active-node-cancel-right;
  width: $wk-org-active-node-save-width;
  height: $wk-org-active-node-save-height;
}
.wk-org-biz__table {
  flex: 1;
  margin: $wk-org-biz-table-margin;
  :deep(.el-table__inner-wrapper) {
    min-height: 170px;
  }
  :deep(.el-empty) {
    padding: 0;
  }
  :deep(.el-table__empty-block) {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  :deep(.el-empty__image) {
    width: 64px !important;
  }
  :deep(.el-empty__image svg) {
    width: 64px !important;
    height: 64px !important;
  }
  :deep(.el-empty__description) {
    margin-top: 0;
  }
}
.wk-org-biz__pagination {
  justify-content: end;
  padding-bottom: $wk-org-form-item-center;
}
.wk-org__tree-search {
  cursor: pointer;
}
.wk-org__create-node {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}
.wk-mgmt__filter {
  padding: $wk-org-border-radius $wk-org-border-radius 0 $wk-org-border-radius;
  margin: $wk-org-card-margin 0;
  background: $wk-org-color-white;
  border-radius: $wk-org-tree-node-padding;
  display: grid;
  grid-template-columns: repeat(4, 25%);
  :deep(.el-form-item) {
    margin-right: 0;
    margin-bottom: $wk-org-border-radius;
  }
  :deep(.item-1) {
    padding-right: $wk-org-active-node-save-height;
  }
  :deep(.item-2) {
    padding-right: $wk-org-border-radius;
  }
  :deep(.item-3) {
    padding-left: $wk-org-border-radius;
  }
  :deep(.item-4) {
    padding-left: $wk-org-active-node-save-height;
  }
  :deep(.plus-item) {
    grid-column: span 3;
    :deep(.el-form-item__content) {
      justify-content: end;
    }
  }
}
.wk-mgmt__create-action {
  position: absolute;
  right: $wk-org-border-radius;
  transform: translateY($wk-org-border-radius);
  z-index: 10;
}
.wk-mgmt__table {
  padding: $wk-org-header-height $wk-org-border-radius $wk-org-border-radius $wk-org-border-radius;
}
.wk-mgmt__pagination {
  padding: $wk-org-border-radius;
  justify-content: end;
  background: $wk-org-color-white;
}
.wk-biz-type__filter {
  padding: $wk-org-border-radius $wk-org-border-radius 0 $wk-org-border-radius;
  margin: $wk-org-card-margin 0;
  background: $wk-org-color-white;
  border-radius: $wk-org-tree-node-padding;
}
.wk-org__fold {
  position: absolute;
  top: $wk-org-card-margin;
  right: $wk-org-border-radius;
  cursor: pointer;
  &.active {
    transform: rotate(180deg);
  }
}
.wk-org__tree-tag {
  width: $wk-org-tree-wrapper-height;
  height: $wk-org-form-item-left;
  margin-left: $wk-org-tree-tag-margin-left;
  border-radius: $wk-org-active-node-save-right;
  padding: $wk-org-subtitle-width $wk-org-tree-tag-padding-bottom;
  background: rgba(0, 98, 255, 0.1);
}
.wk-org__inner-wrapper {
  width: calc(100% - $wk-org-aside-width);
  margin-left: $wk-org-card-margin;
}
.wk-org__scroll-container {
  display: flex;
  flex-direction: column;
  &.no-fold {
    display: block;
    height: calc(100% - $wk-org-scroll-container-height);
    overflow-y: auto;
  }
}
.wk-org__empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.wk-org__empty__desc {
  margin-top: $wk-org-form-item-left;
  :deep(span) {
    margin-left: $wk-org-tree-tag-padding-bottom;
    color: $wk-org-primary-color;
    cursor: pointer;
  }
}
